$(document).ready(function(){
    $.ajax({
        url: '/js/group.json',
        type: 'get',
        data:"",
        dataType: 'json',
        error: function (error) {
            console.log(error);
            alert(error);
        },
        success: function (data) {
            $("#chose_group").html("");
            var tableStr = "<table>";

            tableStr = tableStr + "<thead><th>编号</th><th>答辩时间</th><th>目前人数</th><th>可选</th></thead>";
            for (var i = 0; i < data.length; i++) {
                tableStr = tableStr + "<tr><td>" + data[i].num + "</td>" + "<td>" + data[i].time + "</td>" + "<td>" + data[i].people_number + "<td><button class='btn btn-info btn-xs' id='"+data[i].num+"'>选择</button></td></tr>";
            }
            tableStr = tableStr + "</table>";
            //将动态生成的table添加的事先隐藏的div中.
            $("#chose_group").html(tableStr);
        }
    })}
)

